            <h2>Comment Manager</h2>
            
<!--              End .shortcut-buttons-set -->
            
            <div class="clear"></div> <!--  End .clear  --> 
           
            
            
            <div class="content-box"> <!-- Start Content Box --> 
                
                <div class="content-box-header">
                    
                    <div style="float:left;">
                        <a name="listofcontent"><h3>List of Comments</h3></a>
                   </div>     
                   <div style="float:right;padding-right:20px;padding-top:5px;">
                        <form class="search" name="search" method="post" action="{{$APP_BASE_URL}}comment/admin/manager">
                            <input class="text-input small-input" type="text" name="condition[keyword]" id="keyword" value="{{$condition.keyword}}"/>
                            
                            <select name="condition[scontent_category_id]">
                                <option value="">All categories</option>
                            {{foreach from=$allCats item=item}}
                                <option value="{{$item.scontent_category_id}}" {{if $condition.scontent_category_id== $item.scontent_category_id}}selected="selected"{{/if}}>{{$item.name}}</option>
                            {{/foreach}}
                            </select> 
                            <input class="button" type="submit" value="Search" />
                        </form>
                        
                   </div>
                    
                </div>  <!-- End .content-box-header --> 
                
                <div class="content-box-content">
                    
                    <div class="tab-content default-tab" id="tab1">  <!-- This is the target div. id must match the href of this div's tab  --> 
                        
                       
                       
<!--                         MESSAGE HERE -->
                        {{if $allComments|@count <= 0}}
                        <div class="notification information png_bg">
                            <a href="#" class="close"><img src="{{$LAYOUT_HELPER_URL}}admin/images/icons/cross_grey_small.png" title="Close this notification" alt="close" /></a>
                            <div>
                                No comment with above conditions.
                            </div>
                        </div>
                        {{/if}}
                        
                        {{if $commentMessage|@count > 0 && $commentMessage.success == true}}
                        <div class="notification success png_bg">
                            <a href="#" class="close"><img src="{{$LAYOUT_HELPER_URL}}admin/images/icons/cross_grey_small.png" title="Close this notification" alt="close" /></a>
                            <div>
                                {{$commentMessage.message}}
                            </div>
                        </div>
                        {{/if}}
                        
                        {{if $commentMessage|@count > 0 && $commentMessage.success == false}}
                        <div class="notification error png_bg">
                            <a href="#" class="close"><img src="{{$LAYOUT_HELPER_URL}}admin/images/icons/cross_grey_small.png" title="Close this notification" alt="close" /></a>
                            <div>
                                {{$commentMessage.message}}
                            </div>
                        </div>
                        {{/if}}
                        
<!--                         END MESSAGE -->
                        
                        
                        
                       
                        {{if $allComments|@count > 0}}
                        <table>
                            <thead>
                                <tr>
                                   <th width="3%"><input class="check-all" type="checkbox" /></th>
                                   <th width="3%">ID</th>
                                   <th width="3%">Portal</th>
                                   <th width="10%">Content</th>
                                   <th width="10%">Name</th>
                                   <th width="10%">Email</th>
                                   <th width="10%">Comment</th>
                                   <th width="3%">Enable</th>
                                   <th width="3%">Action</th>
                                </tr>
                                
                            </thead>
                         
                         
                            <tbody>
                            
                            {{foreach from=$allComments item=item}}
                                <tr>
                                    <td><input type="checkbox" value="{{$item.comment_id}}" name="allComments"/></td>
                                    <td>{{$item.comment_id}}</td>
                                    <td>{{$item.portal_id}}</td>
                                    <td>  
                                        Title:{{$item.title}}-(ID:{{$item.scontent_id}})<br> 
                                        Category:{{$item.catname}}
                                    </td>
                                    <td>{{$item.name}}</td>
                                    <td>{{$item.email}}</td>
                                    <td>{{$item.comment}}</td>
                                    <td class="center">
                                        {{if $item.enabled == '1'}}
                                            <a href="{{$APP_BASE_URL}}comment/admin/disable-comment/id/{{$item.comment_id}}" ><img src="{{$LAYOUT_HELPER_URL}}admin/images/icons/visible16x16.png"></a>
                                        {{else}}
                                            <a href="{{$APP_BASE_URL}}comment/admin/enable-comment/id/{{$item.comment_id}}" ><img src="{{$LAYOUT_HELPER_URL}}admin/images/icons/invisible16x16.png"></a>
                                        {{/if}}
                                    </td>
                                    <td class="center">
                                        <!-- Icons -->
                                         <a href="{{$APP_BASE_URL}}comment/admin/edit/id/{{$item.comment_id}}" title="Edit"><img src="{{$LAYOUT_HELPER_URL}}admin/images/icons/pencil.png"  alt="Edit" /></a>
                                         <a href="javascript:deleteAComment({{$item.comment_id}});" title="Delete"><img src="{{$LAYOUT_HELPER_URL}}admin/images/icons/cross.png"  alt="Delete" /></a> 
                                       <!--   
                                         <a href="#" title="Send Mail"><img src="{{$LAYOUT_HELPER_URL}}admin/images/icons/mail_send_16.png"  alt="Send Mail" /></a>
                                        -->
                                    </td>
                                </tr>
                            {{/foreach}}    
                                
                            </tbody>
                        </table>
                  
                        
                        <br/>
                        <!-- CHOOSE ACTION -->
                        {{p name=edit_comment module=comment}}
                        <div class="bulk-actions align-left" style="float: left;padding-top: 14px;">
                            <select id="action">
                                <option value=";">Choose an action...</option>
                                {{p name=delete_comment module=comment}}
                                <option value="deleteComment();">Delete</option>
                                {{/p}}
                                <option value="enableComment();">Enable</option>
                                <option value="disableComment();">Disable</option>
                            </select>
                            <a class="button" href="javascript:applySelected();">Apply to selected</a>
                        </div>
                        {{/p}}
                        
                        <div class="bulk-actions align-left" style="float: left;padding-top: 10px; padding-left:30px;">
                            <form class="search" name="search" method="post" action="{{$APP_BASE_URL}}comment/admin/manager">
                                Display #
                                <select name="displayNum" onchange="this.parentNode.submit();" style="clear: both;">
                                    <option value="5" {{if $displayNum == 5}} selected="selected" {{/if}}>5</option>
                                    <option value="10" {{if $displayNum == 10}} selected="selected" {{/if}}>10</option>
                                    <option value="20" {{if $displayNum == 20}} selected="selected" {{/if}}>20</option>
                                    <option value="50" {{if $displayNum == 50}} selected="selected" {{/if}}>50</option>
                                    <option value="100" {{if $displayNum == 100}} selected="selected" {{/if}}>100</option>
                                    <option value="1000000000" {{if $displayNum >= 1000000000}} selected="selected" {{/if}}>All</option>
                                </select>
                            </form>
                        </div>
                        
                        <!-- PAGINATION -->
                        {{if $countAllPages > 1}}
                        <div class="pagination" style="float: right;">
                            {{if $first}}
                            <a href="?page=1" class="number" title="First Page">&laquo; First</a>
                            {{/if}}
                            {{if $prevPage}}
                            <a href="?page={{$prevPage}}" class="number" title="Previous Page">&laquo;</a>
                            {{/if}}
                            
                            {{foreach from=$prevPages item=item}}
                            <a href="?page={{$item}}" class="number" title="{{$item}}">{{$item}}</a>
                            {{/foreach}}
                            
                            <a href="#" class="number current" title="{{$currentPage}}">{{$currentPage}}</a>
                            
                            {{foreach from=$nextPages item=item}}
                            <a href="?page={{$item}}" class="number" title="{{$item}}">{{$item}}</a>
                            {{/foreach}}
                            
                            {{if $nextPage}}
                            <a href="?page={{$nextPage}}" class="number" title="Next Page">&raquo;</a>
                            {{/if}}
                            {{if $last}}
                            <a href="?page={{$countAllPages}}" class="number" title="Last Page">Last &raquo;</a>
                            {{/if}}
                        </div> <!-- End .pagination -->
                        {{/if}}
                    {{/if}}    
                        
                        <div class="clear"></div>
                    </div> <!-- End #tab1 -->
                    
                    
                </div> <!-- End .content-box-content -->
                
            </div> <!-- End .content-box -->
            
            
            <div class="clear"></div>
            
<script language="javascript" type="text/javascript">
$(document).ready(function(){
    document.getElementById('keyword').select();
    document.getElementById('keyword').focus();
});

function applySelected()
{
	var task = document.getElementById('action').value;
	eval(task);
}
function enableComment()
{
    var all = document.getElementsByName('allComments');
    var tmp = '';
    for (var i = 0; i < all.length; i++) {
        if (all[i].checked) {
             tmp = tmp + '_' + all[i].value;
        }
    }
    if ('' == tmp) {
        alert('Please choose an comment');
    }
    window.location.href = '{{$APP_BASE_URL}}comment/admin/enable-general-comment/id/' + tmp;
}

function disableComment()
{
    var all = document.getElementsByName('allComments');
    var tmp = '';
    for (var i = 0; i < all.length; i++) {
        if (all[i].checked) {
             tmp = tmp + '_' + all[i].value;
        }
    }
    if ('' == tmp) {
        alert('Please choose an comment');
    }
    window.location.href = '{{$APP_BASE_URL}}comment/admin/disable-general-comment/id/' + tmp;
}

function deleteComment()
{
    var all = document.getElementsByName('allComments');
    var tmp = '';
    var count = 0;
    for (var i = 0; i < all.length; i++) {
        if (all[i].checked) {
             tmp = tmp + '_' + all[i].value;
             count++;
        }
    }
    if ('' == tmp) {
        alert('Please choose an comment');
        return;
    } else {
    	result = confirm('Are you sure you want to delete ' + count + ' comment(s)?');
        if (false == result) {
            return;
        }
    }
    window.location.href = '{{$APP_BASE_URL}}comment/admin/delete-general-comment/id/' + tmp;
}


function deleteAComment(id)
{
    result = confirm('Are you sure you want to delete this comment?');
    if (false == result) {
        return;
    }
    window.location.href = '{{$APP_BASE_URL}}comment/admin/delete-comment/id/' + id;
}
</script>
